import React from 'react';
import styled from 'styled-components';

interface DecorativePanelProps {
  children?: React.ReactNode;
  title?: string;
  position?: 'left' | 'right' | 'center';
  width?: string;
  height?: string;
  top?: string;
}

const Container = styled.div<{ position?: string; width?: string; height?: string; top?: string }>`
  position: absolute;
  ${props => props.position === 'left' ? 'left: 20px;' : 
    props.position === 'right' ? 'right: 20px;' : 
    'left: 50%; transform: translateX(-50%);'}
  top: ${props => props.top || '20px'};
  width: ${props => props.width || '300px'};
  height: ${props => props.height || 'auto'};
  background: linear-gradient(
    135deg,
    rgba(0, 20, 50, 0.9) 0%,
    rgba(0, 40, 80, 0.8) 100%
  );
  border: 1px solid rgba(0, 150, 255, 0.3);
  padding: 15px;
  color: #fff;
  
  &::before,
  &::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(0, 150, 255, 0.3);
    pointer-events: none;
  }

  &::before {
    top: -5px;
    left: -5px;
    clip-path: polygon(
      0 0,
      20px 0,
      20px 2px,
      2px 2px,
      2px 20px,
      0 20px
    );
    border-right: none;
    border-bottom: none;
  }

  &::after {
    bottom: -5px;
    right: -5px;
    clip-path: polygon(
      100% 100%,
      calc(100% - 20px) 100%,
      calc(100% - 20px) calc(100% - 2px),
      calc(100% - 2px) calc(100% - 2px),
      calc(100% - 2px) calc(100% - 20px),
      100% calc(100% - 20px)
    );
    border-left: none;
    border-top: none;
  }
`;

const Title = styled.div`
  position: relative;
  padding: 5px 0;
  margin-bottom: 10px;
  font-size: 14px;
  color: rgba(0, 150, 255, 0.8);

  &::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: rgba(0, 150, 255, 0.8);
  }

  &::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(
      90deg,
      rgba(0, 150, 255, 0.8) 0%,
      rgba(0, 150, 255, 0.2) 100%
    );
  }
`;

const Content = styled.div`
  position: relative;
  z-index: 1;
`;

const DecorativePanel: React.FC<DecorativePanelProps> = ({
  children,
  title,
  position = 'left',
  width,
  height,
  top
}) => {
  return (
    <Container position={position} width={width} height={height} top={top}>
      {title && <Title>{title}</Title>}
      <Content>{children}</Content>
    </Container>
  );
};

export default DecorativePanel; 